# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=lzo2

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.06
pkgrel=2
pkgdesc="Portable lossless data compression library (mingw-w64)"
arch=(any)
url="http://www.oberhumer.com/opensource/lzo"
license=("GPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
options=('staticlibs' 'strip')
source=("$url/download/lzo-${pkgver}.tar.gz"
    "liblzo2-2.06-1.src.patch")
md5sums=('95380bd4081f85ef08c5209f4107e9f8'
         'a3bf24d94aadf859f42f56cf095752fd')

prepare() {
  cd "${srcdir}/lzo-${pkgver}"
  patch -p1 -i ${srcdir}/liblzo2-2.06-1.src.patch
}

build() {
    mkdir -p ${srcdir}/build-${CARCH} && cd ${srcdir}/build-${CARCH}
    ../lzo-${pkgver}/configure \
      --prefix=${MINGW_PREFIX} \
      --host=${MINGW_CHOST} \
      --build=${MINGW_CHOST} \
      --target=${MINGW_CHOST} \
      --enable-static \
      --enable-shared
    make
}

package() {
    cd "${srcdir}/build-${CARCH}"
    make DESTDIR="$pkgdir" install
}
